Add animation effect to ajax response #886
-
I had below code to load contents with ajax, and I want to add an animation to contents when loaded.
I added below code after success (line 10), but when ajax items loaded animation fired on all items which loaded before and loading now! is there any idea to fire anime-js just on new items loaded? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You need a way to only target the new added elements. // Store the count of existing items before adding new ones
const existingCount = $('.loadMoreRepeat').length;
// Insert the new content
// Select only the newly added items
const newItems = $('.loadMoreRepeat').slice(existingCount);
// Animate only the new items (v4 syntax)
animate(newItems, {
scale: [.5, 1]
}); Closing for now but feel free to re-open if it doesn't answer your question. |
Beta Was this translation helpful? Give feedback.
You need a way to only target the new added elements.
Maybe something like this:
Closing for now but feel free to re-open if it doesn't answer your question.